package com.xm.xmapp.customview;

import android.annotation.SuppressLint;
import android.app.Dialog;
import android.content.Context;
import android.os.Bundle;
import android.util.DisplayMetrics;
import android.view.LayoutInflater;
import android.view.View;
import android.view.Window;
import android.view.WindowManager;

import com.xm.xmapp.R;

public class YHQTipDialog extends Dialog {

	private Context context;

	public YHQTipDialog(Context context) {
		super(context, R.style.FenShiDialog);
		// TODO Auto-generated constructor stub
		this.context = context;

	}

	@SuppressLint("InflateParams")
	public void init() {
		LayoutInflater inflater = LayoutInflater.from(context);
		View view = inflater.inflate(R.layout.dialog_yhq_tip, null);

		view.findViewById(R.id.img).setOnClickListener(
				new View.OnClickListener() {

					@Override
					public void onClick(View v) {
						dismiss();

					}
				});

		setContentView(view);

		Window dialogWindow = getWindow();
		WindowManager.LayoutParams lp = dialogWindow.getAttributes();
		DisplayMetrics d = context.getResources().getDisplayMetrics(); // 获取屏幕宽、高用
		lp.width = (int) d.widthPixels; // 高度设置为屏幕的0.6
		lp.height = (int) d.heightPixels;
		dialogWindow.setAttributes(lp);
	}

	@Override
	public void show() {
		// TODO Auto-generated method stub
		super.show();
		/** 3.自动弹出软键盘 **/

	}

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		init();

	}
}
